
#import "InfoView.h"

static char *imageName[3] = { "app", "hole", "tete" };

@implementation InfoView

- animateInfo:sender
{
[self display];

if (sender == teteButton)
	[self animateDissolve:2];
else [self animateDissolve:0];
return self;
}

- animateDissolve:(int)index
{
id image;
float percent;
NXPoint aPoint;

if (index != current)
{
[self lockFocus];

aPoint.x = 0.0;
aPoint.y = 0.0;


image= [NXImage findImageNamed:imageName[index]];

for (percent=0.0;percent<=1.0;percent+=0.02)
	{
	if (NXUserAborted())
		{
		percent=1.0;
		}
	[image dissolve:percent toPoint:&aPoint];
	[window flushWindow];
	}
[self unlockFocus];
current = index;
}
return self;
}

- drawSelf:(const NXRect *)rects :(int)rectCount
{
id image;
static NXPoint aPoint = { 0.0 , 0.0 };

image= [NXImage findImageNamed:imageName[current]];
[image composite:NX_SOVER toPoint:&aPoint];
return self;
}

- mouseDown:(NXEvent *)theEvent
{
if (current)
	[self animateDissolve:0];
else [self animateDissolve:1];
return self;
}
@end
